#!/bin/ash

REMOTE_URL="http://192.168.0.233:443/imx280a_exe_folder/"
LOCAL_DIR="/home/user"

HTML_CONTENT=$(wget -q -O- "$REMOTE_URL")
echo "$HTML_CONTENT"


FILES=$(echo "$HTML_CONTENT" | grep -o '<a href="[^"]*"' | sed 's|<a href="||' | sed 's/["]//g')
echo $FILES



# 下载提取出来的文件
for FILE in $FILES; do
# 构建远程文件的完整URL
    REMOTE_FILE="${REMOTE_URL}${FILE}"
# 构建本地文件的完整路径
        LOCAL_FILE="${LOCAL_DIR}/${FILE}"

# 如果本地不存在该文件，则下载
            if [[ ! -f "$LOCAL_FILE" ]]; then
            echo "Downloading $REMOTE_FILE to $LOCAL_FILE"

            wget -q "$REMOTE_FILE" -O "$LOCAL_FILE"

            # 添加可执行权限

            chmod +x "$LOCAL_FILE"
            fi
            done
